import {createRouter, createWebHashHistory} from 'vue-router'
import {
    FILE_LIST_PATH,
    FORGOT_PASSWORD_PATH,
    HOME_PATH,
    LOGIN_PATH,
    OFFICE_PREVIEW_PATH,
    REGISTER_PATH
} from "@/const/RouterPathConst"

const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            name: 'home',
            redirect: FILE_LIST_PATH,
        },
        {
            path: HOME_PATH,
            name: 'inner',
            redirect: FILE_LIST_PATH,
            children: [
                {
                    path: FILE_LIST_PATH,
                    component: () => import('../views/file/FileList.vue'),
                    name: 'fileList',
                },
            ]
        },
        {
            path: LOGIN_PATH,
            name: 'login',
            component: () => import("@/views/login/UserLogin.vue"),
        },
        {
            path: REGISTER_PATH,
            name: 'register',
            component: () => import("@/views/login/UserRegister.vue"),
        },
        {
            path: FORGOT_PASSWORD_PATH,
            name: 'forgotPassword',
            component: () => import("@/views/login/ForgotPassword.vue"),
        },
        {
            path: OFFICE_PREVIEW_PATH,
            name: 'officepreview',
            component: () => import("@/views/file/OfficePreview.vue"),
        },
    ]
})

export default router
